#include<iostream>
#include<vector>
#include<queue>
#include<cstring>
#include<cmath>
#include<map>
#include<set>
#include<cstdio>
#include<algorithm>
#define debug(a) cout<<#a<<"="<<a<<endl;
using namespace std;
const int maxn=3e5+1000;
typedef long long LL;
inline LL read(){LL x=0,f=1;char ch=getchar();	while (!isdigit(ch)){if (ch=='-') f=-1;ch=getchar();}while (isdigit(ch)){x=x*10+ch-48;ch=getchar();}
return x*f;}
LL dp[maxn][4];
LL a[maxn];
int main(void){
   LL n,x;n=read();x=read();
   for(LL i=1;i<=n;i++) a[i]=read();
   LL ans=-1e18;
   for(LL i=1;i<=n;i++){
      dp[i][0]=max(dp[i-1][0]+a[i],a[i]);
      dp[i][1]=max( max(dp[i-1][1]+a[i]*x,dp[i-1][0]+a[i]*x),a[i]*x );
      dp[i][2]=max( max(dp[i-1][1]+a[i],dp[i-1][2]+a[i]),a[i]);
      ans=max(ans,max(dp[i][1],dp[i][2]));
   }
   cout<<max(ans,(LL)0)<<"\n";
   return 0;
}
